########################  1 ##################
#cmake_minimum_required (VERSION 2.8)
#
#project (demo)
#
#add_executable(main main.c)

cmake_minimum_required(VERSION 2.8.9)
set(CMAKE_BUILD_TYPE Release)
# specify the cross compiler
SET(CMAKE_C_COMPILER gcc)
SET(CMAKE_CXX_COMPILER g++)

# where is the target environment 
SET(CMAKE_FIND_ROOT_PATH  /home/rootqt/SylixOS/lib)
set(OPENSSL_ROOT_DIR /home/rootqt/SylixOS/lib)

# search for programs in the build host directories (not necessary)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

# configure Boost and Qt
SET(QT_QMAKE_EXECUTABLE /opt/armv7-sylixos-qt-4.8.7/bin/qmake)

set(CMAKE_C_FLAGS -march=mips32 -EL -G 0 -mno-branch-likely -mhard-float  -O2 -g1 -gdwarf-2 -Wall -fmessage-length=0 -fsigned-char -fno-short-enums -fno-strict-aliasing   -fPIC -mabicalls -DSYLIXOS -I/d/SylixOS_WS/mips/libsylixos/SylixOS -I/d/SylixOS_WS/mips/libsylixos/SylixOS/include -I/d/SylixOS_WS/mips/libsylixos/SylixOS/include/network)

set(CMAKE_CXX_FLAGS -march=mips32 -EL -G 0 -mno-branch-likely -mhard-float -mabicalls -Wl,-shared -fPIC -shared -DSYLIXOS -I/d/SylixOS_WS/mips/libsylixos/SylixOS -I/d/SylixOS_WS/mips/libsylixos/SylixOS/include -I/d/SylixOS_WS/mips/libsylixos/SylixOS/include/network)

set(CMAKE_EXE_LINKER_FLAGS -nostdlib -mabicalls -fPIC -shared -L/d/SylixOS_WS/mips/libsylixos/Release -L/d/SylixOS_WS/mips/libsylixos/libsylixos/Debug -lstdc++ -lcextern -lvpmpdm -lm -lgcc -ldsohandle)

SET(CMAKE_C_COMPILER_FORCED TRUE)
SET(CMAKE_CXX_COMPILER_FORCED TRUE)

#Bring the headers, such as Student.h into the project
include_directories(include)

#Can manually add the sources using the set command as follows:
#set(SOURCES src/mainapp.cpp src/Student.cpp)

#However, the file(GLOB...) allows for wildcard additions:
file(GLOB SOURCES "*.c")

add_library(testage SHARED ${SOURCES})
install(TARGETS testage DESTINATION /usr/lib)
